package com.oocl.ita.sakura.handler;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;

import com.oocl.ita.sakura.forwarder.Forwarder;
import com.oocl.ita.sakura.protocol.Protocol;

public class InvalidHandler implements IHandler {
	public void handle(Protocol protocol)  {
		System.out.println("InvalidHandler: Invalid MsgType" + Thread.currentThread().getName());
		ObjectOutputStream oos = (ObjectOutputStream) Forwarder.threadlocaloos.get();
		Map<String, Object> params = new HashMap();
		params.put("invalid", "IMServer : Invalid Command!");
		Protocol retProtocol = new Protocol("invalid", params);
		try {
			oos.writeObject(protocol);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println("InvalidHandler : oos write error!");
			e.printStackTrace();
		}
	}
}
